<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="AAuto" /> 
<title>用web窗体设计程序界面</title>
<link href="../style.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="maincontent">
<h1>用web窗体设计程序界面</h1>
 <div class="desc">参考:<a href="../libraries/std/web/html.html"></a> <a href="webform.html">创建web窗体</a> <a href="external.html">在网页脚本中调用AAuto函数</a><a href="doScript.html"></a></div>
 <div>
    <h2>web UI</h2>
  <p>使用 <a href="external.html">wb.external</a> 可以在网页中轻松执行本机代码,这使在AAuto中用网页制作程序界面、以替代传统的windows窗体非常的容易,网页有丰富的界面展现能力,使用网页制作工具可以轻松制作出非常漂亮的界面,这在传统UI设计中是非常困难的事.</p>
  <p>下面是一个简单示例.<br />
  </p>
  <pre>
import win.ui; 
import web.form;
<span class="comment">/*DSG{{*/</span>
var winform = win.form(parent=...; min=1;scroll=1
	;bottom=17;max=1;right=562;border="none";text="" )
winform.add(  )
<span class="comment">/*}}*/</span>

<span class="comment">//创建web窗体</span>
var wb = web.form( winform 
	,0x8/*_UIFLAG_SCROLL_NO*/ | 0x4/*_UIFLAG_NO3DBORDER*/
	<span class="comment">,//可输入_DLCTL_ 前缀的常量以控制下载行为</span>
	);
   
wb.external = {
	title_drag = function(){ 
		::PostMessage(winform.hwnd, 0xA1/*_WM_NCLBUTTONDOWN*/ , 0x2/*_HTCAPTION*/, 0) 
	}
	title_br = function(){ 
		::SendMessageInt(winform.hwnd, 0xA1/*_WM_NCLBUTTONDOWN*/, 0xB/*_HTRIGHT*/, 0);
	} 
	title_min = function(){ 
		::PostMessage(winform.hwnd,  0x112/*_WM_SYSCOMMAND*/,0xF020/*_SC_MINIMIZE*/, 0); 
	}
	title_close = function(){ 
		winform.close() 
	}
	
}

html =<span class="comment">/*
&lt;body style=&quot;margin-left: 0px;margin-top: 0px;margin-right
	: 0px;margin-bottom: 0px;&quot;&gt;
&lt;table id=&quot;bar&quot; width=&quot;100%&quot; border=&quot;0&quot; cellpadding=&quot;2&quot; cellspacing=&quot;0&quot; 
	style =&quot;background-color: #99FFFF;&quot;&gt;
	&lt;tr &gt;
    &lt;td width=&quot;32&quot; style=&quot;font-family: Marlett;font-size: 10pt
    	;cursor:pointer&quot; onmousedown=&quot;external.title_close()&quot;&gt;r&lt;/td&gt;
    &lt;td onmousedown=&quot;external.title_drag()&quot; &gt;
    &lt;div id=&quot;message&quot; style =&quot;font-family: '宋体'; font-size: 9pt
    ;cursor:pointer&quot;&gt; 请进行一系列的操作,按这里可以拖动&lt;/div&gt;&lt;/td&gt;
    &lt;td width=&quot;32&quot; align=&quot;right&quot; style=&quot;font-family: Marlett;font-size: 12pt
    	;cursor:se-resize&quot;  onmousedown=&quot;external.title_br()&quot;&gt;p&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;
&lt;/body&gt;
*/</span>
wb.write(html)

ele = wb.getEle("message")
ele.innerHTML = <span class="string">"大家好,我是Web UI"</span>

winform.show(true) 

<span class="comment">//进入消息循环</span>
win.loopMessage(); 

</pre>
  <p>打开下面的链接,您可以看到一个更完整的范例:<br />
    <a href="https://svn.ecranesoft.com/svn/aauto/Example/WEB窗体/UI/sample.aau">https://svn.ecranesoft.com/svn/aauto/Example/WEB窗体/UI/sample.aau  </a><br />
  您也可以在&quot;快手-&gt;范例-&gt;web窗体-&gt;UI-&gt;sample.aau&quot; 找到此范例</p>
  <p>在上面的范例中我们直接使用wb.write写入网页内容,可选的方法是用<br />
    您也可以使 <a href="control.html#go">wb.go</a> 打开硬盘上的网页,或 <a href="control.html#res">链接到资源文件中的网页</a></p>
 </div>

<div></div>
</div>
</body>
</html>